package org.zht.dormpro.dorm.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.zht.dormpro.dorm.model.TbManager;

public interface TbManagerMapper {
    @Delete({
        "delete from tb_manager",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into tb_manager (id, manager_id, ",
        "manager_name, manager_image, ",
        "floor_id, manage_type, ",
        "manager_phone, manager_append, ",
        "manager_status)",
        "values (#{id,jdbcType=INTEGER}, #{managerId,jdbcType=VARCHAR}, ",
        "#{managerName,jdbcType=VARCHAR}, #{managerImage,jdbcType=VARCHAR}, ",
        "#{floorId,jdbcType=VARCHAR}, #{manageType,jdbcType=TINYINT}, ",
        "#{managerPhone,jdbcType=VARCHAR}, #{managerAppend,jdbcType=VARCHAR}, ",
        "#{managerStatus,jdbcType=TINYINT})"
    })
    int insert(TbManager record);

    int insertSelective(TbManager record);

    @Select({
        "select",
        "id, manager_id, manager_name, manager_image, floor_id, manage_type, manager_phone, ",
        "manager_append, manager_status",
        "from tb_manager",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("org.zht.dormpro.dorm.mapper.TbManagerMapper.BaseResultMap")
    TbManager selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(TbManager record);

    @Update({
        "update tb_manager",
        "set manager_id = #{managerId,jdbcType=VARCHAR},",
          "manager_name = #{managerName,jdbcType=VARCHAR},",
          "manager_image = #{managerImage,jdbcType=VARCHAR},",
          "floor_id = #{floorId,jdbcType=VARCHAR},",
          "manage_type = #{manageType,jdbcType=TINYINT},",
          "manager_phone = #{managerPhone,jdbcType=VARCHAR},",
          "manager_append = #{managerAppend,jdbcType=VARCHAR},",
          "manager_status = #{managerStatus,jdbcType=TINYINT}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(TbManager record);
}